package com.eastjet.maintenance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eastjet.maintenance.domain.AllocationDetails;
import com.eastjet.maintenance.mapper.AllocationDetailsMapper;
import com.eastjet.maintenance.service.AllocationDetailsService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 杨博文
 * @description 针对表【allocation_details(调拨设备明细)】的数据库操作Service实现
 * @createDate 2024-11-25 09:23:37
 */
@Service
public class AllocationDetailsServiceImpl extends ServiceImpl<AllocationDetailsMapper, AllocationDetails> implements AllocationDetailsService {

    /*
    新增调拨设备明细
     */
    @Override
    public Boolean InsertAllocationDetails(List<AllocationDetails> allocationDetails) {
        return this.saveBatch(allocationDetails);
    }

    /*
     * 更新调拨设备明细
     */
    @Override
    public Boolean UpdateAllocationDetails(List<AllocationDetails> allocationDetails) {
        return this.updateBatchById(allocationDetails);
    }

    /*
     * 删除调拨设备明细
     */
    @Override
    public Boolean DeleteAllocationDetails(List<AllocationDetails> allocationDetails) {
        return this.removeByIds(allocationDetails);
    }

    /*
     * 根据调拨单号查询调拨设备明细
     */
    @Override
    public List<AllocationDetails> selectAllocationDetailsByAllocationId(String code) {
        return this.list(new QueryWrapper<AllocationDetails>().and(i -> i.eq("code", code).eq("tombstone", 0)));
    }
}




